In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.
Mob feud rages in Equatorial Byteotia. The mob bosses have come to the country's capital, Byteburg, to settle the dispute. Negotiations were very tense, and at one point the trigger-happy participants drew their guns. Each participant aims at another with a pistol. Should they go on a killing spree, the shooting will go in accordance with the following code of honour:
Write a programme that:
The first line of the standard input contains the number of participants (). They are numbered from to . The second line contains integers , separated by single spaces, . denotes the number of participant's target. Note that it is possible that for some (the nerves, you know).
Your programme should write out two integers separated by a single space in the first and only line of the standard output. These numbers should be, respectively, the minimum and maximum number of casualties resulting from the shooting.
For the input data:
8 2 3 2 2 6 7 8 5
the correct result is:
3 5
Task author: Wojciech Rytter.